﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Persiennes
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
            comboBox1.Items.Add("Plastic");
            comboBox1.Items.Add("Aluminium");
            comboBox1.Items.Add("Bamboo");
            comboBox1.Items.Add("Textil");
            comboBox1.Items.Add("Stupid");
            comboBox1.SelectedIndex = 0;
            button1.Enabled = false;
            label4.Text = "Total";

        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            if (textBox1.Text.Length != 0)
                button1.Enabled = true;
            
            label4.Text = "";
        }

        private void button1_Click(object sender, EventArgs e)
        {
            double w;
            double h;
            double cena = 0;
            double sum;
            w = Convert.ToDouble(textBox1.Text);
            h = Convert.ToDouble(textBox2.Text);
            switch (comboBox1.SelectedIndex) 
            {
                case 0: cena = 50; break;
                case 1: cena = 100; break;
                case 2: cena = 75; break;
                case 3: cena = 70; break;
                case 4: cena = 60; break;
            }
            sum = (w * h) / 10000 * cena;
            label4.Text = "Size: " + w + "x" + h + " cm. \n" +
            "Price ($/sqm): " + cena.ToString("c") + "\nTotal: " + sum.ToString("c");
        }
        
    }
}
